"""
AI角色扮演项目 - 统一的接口封装包

提供角色扮演、语音对话、多轮对话等功能的完整解决方案
"""

__version__ = "1.0.0"
__author__ = "AI Voice Team"
__description__ = "AI角色扮演和语音对话系统"

# 核心组件导入
from api.agent.role import BaseRole, AssistantRole, TeacherRole, FriendRole, RoleFactory
from api.agent.role_play_agent import RolePlayAgent
from api.models.llm_client import LLMClient
from api.models.knowledge_base import KnowledgeBase

# API接口导入
from api.role_play_api import router as role_play_router
from api.main import app as api_app

# Web UI导入
from web.role_play_ui import main as web_ui_main

# 便捷接口封装
class AICharacterSystem:
    """AI角色扮演系统主类"""
    
    def __init__(self):
        """初始化系统"""
        self.agent = RolePlayAgent()
        self.roles = self.agent.roles
        
    def get_roles(self):
        """获取所有可用角色"""
        return self.roles
        
    def select_role(self, role_id: str):
        """选择角色"""
        return self.agent.select_role(role_id)
        
    async def chat(self, message: str, role_id: str = None, use_knowledge: bool = True):
        """与角色对话"""
        if role_id:
            self.select_role(role_id)
        return await self.agent.chat(message, use_knowledge)
        
    async def chat_stream(self, message: str, role_id: str = None, session_id: str = None, use_knowledge: bool = True):
        """与角色进行流式对话"""
        if role_id:
            self.select_role(role_id)
        async for response in self.agent.chat_stream(message, use_knowledge, session_id):
            yield response

# 便捷函数
def create_character_system():
    """创建角色扮演系统实例"""
    return AICharacterSystem()

def get_available_roles():
    """获取可用角色列表"""
    agent = RolePlayAgent()
    return agent.roles

# 导出所有主要接口
__all__ = [
    # 核心类
    'BaseRole',
    'AssistantRole', 
    'TeacherRole',
    'FriendRole',
    'RoleFactory',
    'RolePlayAgent',
    'LLMClient',
    'KnowledgeBase',
    
    # 系统类
    'AICharacterSystem',
    'create_character_system',
    'get_available_roles',
    
    # API应用
    'role_play_router',
    'api_app',
    
    # Web UI
    'web_ui_main',
    
    # 版本信息
    '__version__',
    '__author__', 
    '__description__'
]